﻿@model MatchSummaryViewModel

<div class="searchitem">
    <div>
        <a class="mainsearch" href="@Url.Action("Index", "Details", new { @id = Model.MatchGuid })">@string.Format("{0} v {1}", Model.Team1Name, Model.Team2Name)</a>
    </div>

    <div class="subsearch">@Model.MatchDate</div>

    <div>
        @if (Model.DbActionType == DbActionType.Search)
        {
            <span><a class="searchactions" href="@Url.Action("Index", "Editor", new { id = Model.MatchGuid })">Edit</a></span>
        }

        @if (Model.CanDelete)
        {
            <span><a class="searchactions" href="@Url.Action("Delete", "Editor", new { id = Model.MatchGuid })" onclick="return confirm('Are you sure?');">Delete</a></span>
        }

        @if ((Model.DbActionType == DbActionType.Search || Model.DbActionType == DbActionType.SearchPendingApprovals) && Model.CanApprove)
        {
            <span><a class="searchactions" href="@Url.Action("ApproveRecord", "Editor", new { id = Model.MatchGuid })">View approvals</a></span>
        }

        @if (Model.DbActionType == DbActionType.SearchRecordForApprovals && Model.CanApprove)
        {
            <span><a class="searchactions" href="@Url.Action("ConfirmApproval", "Editor", new { id = Model.MatchGuid })" onclick="return confirm('Are you sure?');">Confirm approval</a></span>
        }

        @if (User.IsInRole("Admin"))
        {
            <span><a class="searchactions" href="@Url.Action("FullMatch", "Import", new { id = Model.MatchGuid })">Import match</a></span>
        }
    </div>
</div>
